﻿///StringGraphics.as 该类为绘制文本
//vesion 1.0
//author 夏天的树人
package org.summerTree.graphics
{

	import flash.text.*;
	import flash.display.Sprite;
	public class StringGraphics extends Base
	{

		private var contain:Sprite=new Sprite();
		public function DrawString()
		{
			addChild(contain);
		}
		override public function clone():*
		{
			return new StringGraphics();
		}
		/* @ para str 字符串
		 * @ para  fone 字体类型
		 * @ para   x  x坐标
		 * @ para   y  y坐标
		 */
		public function CreatString(str:String,format:TextFormat,x:Number=0,y:Number=0):void
		{
			var txt:TextField=new TextField();
			contain.addChild(txt);

			txt.text=str;
			txt.selectable=false;
			txt.x=x;
			txt.y=y;
			txt.autoSize=TextFieldAutoSize.LEFT;
			txt.setTextFormat(format);
		}
		override public function clear():void
		{
			while (contain.numChildren>0)
			{
				contain.removeChildAt(0);
			}
		}
	}
}